// token接口
import axios from 'axios'
import tokenAjaxInstance from '@/api/tokenAjax.js'

const requestLogin = '/oauth/token'

let createAPI = (url, params) => {
  if (/\/mock\//.test(url)) { 
    return axios.get(`${url}`, params).then(res => res.data)
  }
  return tokenAjaxInstance.post(`${url}`, params).then(res => res.data)
}

let api = {}
api['requestLogin'] = params => {
  return createAPI(requestLogin, params)
}

export default api
